<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Person {
          constructor () {
            this.guanjia = {
              huishou: [],
              taitui: []
            }
          }
        }

        Person.prototype.$emit = function (eventName) {
          if (this.guanjia[eventName]) {
            this.guanjia[eventName].map(i => i())
          }
        }

        Person.prototype.$on = function (eventName, callbacck) {
          if (this.guanjia[eventName]) {
            this.guanjia[eventName].push(callbacck)
          } else {
            this.guanjia[eventName] = [callbacck]
          }
        }

        const app = new Person()
    </script>
</body>
</html>